package com.klb.model;

import javax.persistence.*;

/**
 * Created by fujia on 2016/7/2.
 */
@Entity
@Table(name = "bbs_image", schema = "knowlogebase", catalog = "")
public class BbsImage {
    private int imageId;
    private int userId;
    private String path;

    @Id
    @Column(name = "image_id", nullable = false)
    public int getImageId() {
        return imageId;
    }

    public void setImageId(int imageId) {
        this.imageId = imageId;
    }

    @Basic
    @Column(name = "user_id", nullable = false)
    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "path", nullable = false, length = 32)
    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    @Override
    public boolean equals(Object object) {
        if (this == object) return true;
        if (object == null || getClass() != object.getClass()) return false;

        BbsImage bbsImage = (BbsImage) object;

        if (imageId != bbsImage.imageId) return false;
        if (userId != bbsImage.userId) return false;
        if (path != null ? !path.equals(bbsImage.path) : bbsImage.path != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = imageId;
        result = 31 * result + userId;
        result = 31 * result + (path != null ? path.hashCode() : 0);
        return result;
    }
}
